Pharmaceutical companies face complex challenges in designing and managing their supply chains due to regulatory requirements at the national, international, and internal levels, along with government-imposed constraints such as the sourcing of raw materials, distribution, exchange rates, and production and storage conditions. Designing green and closed-loop supply chain networks can play a crucial role in reducing costs, increasing efficiency, and minimizing the environmental impact of the industry. In this paper, a model for designing green and closed-loop supply chains for pharmaceutical products is proposed, focusing on the optimal location of production, distribution, and recycling centers. The proposed model takes into account both internal factors, such as the selection of raw materials and green technologies, and external factors like optimal site selection and transportation system optimization. The goal of this model is to minimize fixed and operational costs, reduce environmental pollutant emissions, and enhance supply chain sustainability. To solve the problem, mathematical modeling was applied using GAMS software, and the Cuckoo Search Algorithm (CSA) was implemented in MATLAB software. This approach provides optimal and efficient solutions for complex problems, yielding reliable results. The findings of this research indicate that the proposed approach can play a significant role in improving performance and greening pharmaceutical supply chains.